package com.xls.app.service.impl;

import com.xls.app.bean.Category;
import com.xls.app.dao.CategoryDao;
import com.xls.app.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CategoryServiceImpl implements CategoryService {
    @Autowired
    private CategoryDao categoryDao;
    @Override
    public List<Category> listPageCategory(int page, int size,String cateName) {
        return categoryDao.listPage((page-1)*size,size,cateName);
    }

    @Override
    public int countCategory(String cateName) {
        return categoryDao.count(cateName);
    }

    @Override
    public boolean saveCategory(Category category) {
        return categoryDao.save(category)>0;
    }

    @Override
    public boolean removeBatchCategory(List<Integer> cids) {
        return categoryDao.remove(cids)>0;
    }

    @Override
    public boolean updateCategory(Category category) {
        return categoryDao.update(category)>0;
    }

    @Override
    public List<Category> listCategory() {
        return categoryDao.list();
    }
}
